<?php
/**
 * Created by PhpStorm.
 * User: kirito
 * Date: 2019/5/16
 * Time: 上午10:25
 */
include "include.php";

die('is over done');
$config = array(
    'appid' => 'wx4ba5a0e1070e48aa',
    'appsecret' => 'b627d78539abda6da172c767a1182dae'
);
$wx = new \Wechat\WechatCard($config);

$data = array(
    'card' => array(
        "card_type" => "GENERAL_CARD",
        "general_card" => array(
            "sub_card_type" => "GIFT_CARD",
            "background_pic_url" => "http://mmbiz.qpic.cn/mmbiz_png/vOcvRicich7vIk0oZicQokHQBaOzJ8nuGHIqsVgmPIwpgWJLCeXszndYJhVwqib73iafmFf61yy8FuSkYAfNkVN9iapw/0",
            "base_info" => array(
                "max_give_friend_times" => 1,
                "giftcard_info" => array(
                    "price" => 1
                ),
                "logo_url" => "http://mmbiz.qpic.cn/mmbiz_png/vOcvRicich7vIk0oZicQokHQBaOzJ8nuGHIeobGpOTk9IaGe1hN5Fhw4nFygk3kedXzUmbdZiceRiaX1OFE4qoib2L1Q/0",
                "brand_name" => "云机汇",
                "code_type" => "CODE_TYPE_QRCODE",
                "title" => "心意卡",
                "color" => "Color020",
                "notice" => "使用时向服务员出示",
                "service_phone" => "020-88888888",
                "description" => "不可与其他优惠同享",
                "date_info" => array(
                    "type" => "DATE_TYPE_FIX_TIME_RANGE",
                    "begin_timestamp" => 1557999821,
                    "end_timestamp" => 1565948620
                ),
                "sku" => array(
                    "quantity" => 50000000
                ),
                "get_limit" => 0,
                "use_custom_code" => false,
                "can_give_friend" => true,
                "location_id_list" => [],
                "center_title" => "公司首页",
                "center_sub_title" => "云机汇",
                "center_url" => "http://www.jsyunjihui.com/",
                "center_app_brand_user_name" => "gh_30edccecda58@app",
                "center_app_brand_pass" => "pages/index/index",
                "custom_url_name" => "新品推荐",
                "custom_url" => "",
                "custom_app_brand_user_name" => "wx4ba5a0e1070e48aa@app",
                "custom_app_brand_pass" => "pages/index/index",
                "need_push_on_view" => true
            ),
            "advanced_info" => array(
                "text_image_list" => []
            ),
            "supply_bonus" => false,
            "supply_balance" => false,
            "prerogative" => "礼品卡享受更多优惠",
            "auto_activate" => true,
            "init_balance" => 10000,
        )
    )
);

$res = $wx->createCard($data);
// array (size=3)
//   'errcode' => int 0
//   'errmsg' => string 'ok' (length=2)
//   'card_id' => string 'ppw9S1UImBnEdIQrcvakS4UyudvE' (length=28)
var_dump($res);
